#ifndef xType_H__
#define xType_H__

#include "./skyStd.h"

namespace Sky
{
	namespace NRoot
	{
		//TInteger
		typedef long long		Tint64;
		typedef unsigned long long Tuint64;
		typedef int				Tint32;
		typedef unsigned long	Tuint32;
		typedef short			Tint16;
		typedef unsigned short	Tuint16;
		typedef char			Tint8;
		typedef unsigned char	Tuint8;
		typedef unsigned int	Tuint;
		typedef signed   int	Tint;
		typedef char			Tachar;
		typedef Tint			Tbool;
		typedef float			Treal32;
		typedef double			Treal64;
		//typedef long double	Treal128;
		typedef wchar_t		Twchar;
		//typedef unsigned short int   Twchar;
		typedef void*			Tpointer;
		typedef void			Tvoid;
	}
	namespace NType
	{//second def
		//using namespace NRoot;
	
		//typedef NRoot::Tint64			TInt64;
		typedef NRoot::Tint64			i64;
		//typedef NRoot::Tuint64			TUint64;
		typedef NRoot::Tuint64			u64;
		//typedef NRoot::Tuint32			TUint32;
		typedef NRoot::Tuint32			u32;
		//typedef NRoot::Tint32			TInt32;
		typedef NRoot::Tint32			i32;
		typedef NRoot::Tuint16			TUshort;
		typedef NRoot::Tint16			TShort;
		typedef NRoot::Tuint8			TUchar;
		//typedef NRoot::Tuint8			TUint8;
		typedef NRoot::Tuint8			u8;
		//typedef NRoot::Tuint16		TUint16;
		typedef NRoot::Tuint16			u16;
		typedef NRoot::Tint8			TInt8;
		//typedef NRoot::Tint16			TInt16;
		typedef NRoot::Tint8			i8;
		typedef NRoot::Tint16			i16;
#ifdef UNICODE
		typedef NRoot::Twchar			Char;
	#define skyStrlen(str)		0;//wcslen((wchar_t*)str)
	#define skyStrcmp(s1,s2)	1;//wcscmp((wchar_t*)s1,(wchar_t*)s2)
	#define skyStrchr			wcsrchr
	#define  _XT(str)			(Char*)L##str
	#define _XC(chr)			L##chr
#else
	#define skyStrlen		strlen
	#define skyStrcmp		strcmp
	#define skyStrchr		strchr
		typedef NRoot::Tint8			Char;
		#define	 _XC(str)				str
		#define  _XT(str)				str
#endif
		typedef NRoot::Tint32			size_t;
		typedef NRoot::Tbool			Bool;
		typedef NRoot::Twchar			WChar;
		typedef NRoot::Tachar			AChar;
		typedef NRoot::Treal32			Float;
		typedef NRoot::Treal64			Double;
		//typedef Treal128		TLdouble;

		typedef NRoot::Tuint64			TQword;
		typedef NRoot::Tuint32			TDword;
		typedef NRoot::Tuint16			TWord;
		typedef NRoot::Tuint8			TByte;

		typedef NRoot::Tpointer		    TPointer;
		typedef NRoot::Tvoid			Void;

		typedef NRoot::Tint32			TResult;
		typedef struct _Rect
		{
			i32 x;
			i32 y;
			i32 w;
			i32 h;
			_Rect(i32 _l,i32 _t,i32 _w,i32 _h):
			x(_l),y(_t),w(_w),h(_h){}
			_Rect(){}
			Void set(i32 _l,i32 _t,i32 _w,i32 _h)
			{
				x = _l;
				y = _t;
				w = _w;
				h = _h;
			}
		}Rect;

		typedef struct _RectF
		{
			i32 x;
			i32 y;
			i32 w;
			i32 h;
			_RectF(i32 _l,i32 _t,i32 _w,i32 _h):
			x(_l),y(_t),w(_w),h(_h){}
			_RectF(){}
			Void set(i32 _l,i32 _t,i32 _w,i32 _h)
			{
				x = _l;
				y = _t;
				w = _w;
				h = _h;
			}
		}RectF;

		typedef struct _Size
		{
			i32 w;
			i32 h;
			_Size(){}
			_Size(i32 W,i32 H):w(W),h(H){}
		}Size;

		typedef struct _SizeF
		{
			Float w;
			Float h;
			_SizeF(){}
			_SizeF(Float W,Float H):w(W),h(h){}
		}SizeF;

		typedef struct _Point
		{
			i32 x;
			i32 y;
			_Point(){}
			_Point(i32 X,i32 Y):x(X),y(Y){}
		}Point;

		typedef struct _PointF
		{
			Float x;
			Float y;
			_PointF(){}
			_PointF(Float X,Float Y):x(X),y(Y){}
		}PointF;

		typedef struct _Vector2F
		{
			Float x;
			Float y;
			_Vector2F(){}
			_Vector2F(Float X,Float Y):x(X),y(Y){}
		}Vector2F;

		typedef struct _Vector2
		{
			i32 x;
			i32 y;
			_Vector2(){}
			_Vector2(i32 X,i32 Y):x(X),y(Y){}
		}Vector2;

		typedef struct _Color
		{
			u8 r;
			u8 g;
			u8 b;
			u8 a;
			_Color(u8 R,u8 G,u8 B,u8 A = 255):r(R),g(G),b(B),a(A){}
		}Color;
	}

	namespace NValue
	{
		using namespace NType;
#define	vNull NULL
		//static const Void*		vNull			=0;
		//min
		static const i32		vMinUTInt		=0;
		static const TUshort	vMinUshort		=0;
		static const TUchar		vMinUchar		=0;
		static const TByte		vMinByte		=0;
		static const TWord		vMinWord		=0;
		static const TDword		vMinDword		=0;
		static const i32		vMinInt			=0x80000000;
		static const TShort		vMinShort		=(TShort)	0x8000;
		static const Char		vMinChar		=(Char)	0x80;
		static const Float		vMinFloat		=Float(1.175494351e-38F);                 ///< Constant Min Limit F32

		//max
		static const i32		vMaxUTInt		=vMinUTInt-1;
		static const TUshort	vMaxUshort		=0xFFFF;
		static const TUchar		vMaxUchar		=0xFF;
		static const TByte		vMaxByte		=0xFF;
		static const TWord		vMaxWord		=0xFFFF;
		static const TDword		vMaxDword		=0xFFFFFFFF;
		static const i32		vMaxInt			=0x7FFFFFFF;
		static const TShort		vMaxShort		=0x7FFF;
		static const Char		vMaxChar		=0x7F;
		static const Float		vMaxFloat		=Float(3.402823466e+38F);                 ///< Constant Max Limit F32
		
		//const
		static const Float		vConFloatPi		=Float(3.14159265358979323846);        ///< Constant float PI
		static const Float		vConFloat2Pi	=Float(2.0 * 3.14159265358979323846);  ///< Constant float 2*PI
		static const Float		vConFloatEpsilon=Float(0.000001);                       ///< Constant float epsilon used for F32 comparisons

		static const Bool		vTrue   =  1;
		static const Bool		vFalse  =  0;
		enum Status
		{
			vSucess =	0x00000000,
			vFail	=	0xFFFFFFFF
		};
		enum MsgStatus
		{
			vIntercepted    = 0,
			vUnHandled,
			vContinue		,
			vFailed
		};
		typedef enum _ExitCode{
			ExitCode_Success,
			ExitCode_Exit,
			ExitCode_Failed,
			ExitCode_ComLost,
			ExitCode_ResLost,
			ExitCode_AccDenied,
			ExitCode_Unknow
		}ExitCode;
	}
	using namespace Sky::NType;
	using namespace Sky::NValue;
};


#include "./xResult.h"

#endif // xType_H__
